package com.xmg.mgrsite.base;

import com.xmg.p2p.base.query.VideoAuthQO;
import com.xmg.p2p.base.service.ILogininfoService;
import com.xmg.p2p.base.service.IVideoAuthService;
import com.xmg.p2p.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
public class VideoController {
    @Autowired
    private IVideoAuthService videoAuthService;
    @Autowired
    private ILogininfoService logininfoService;
    @RequestMapping("videoAuth")
    public String videoAuth(@ModelAttribute("qo")VideoAuthQO qo, Model model){
        model.addAttribute("pageResult",videoAuthService.query(qo));
        return "videoAuth/list";
    }
    @RequestMapping("videoAuth_audit")
    @ResponseBody
    public JSONResult audit(Long loginInfoValue,int state,String remark){
        videoAuthService.audit(loginInfoValue,state,remark);
        return new JSONResult();
    }
    @ResponseBody
    @RequestMapping("videoAuth_autocomplate")
    public List<Map<String,Object>> autoComplete(String keyword){
        return logininfoService.autoComplete(keyword);
    }
}
